package com.xiaopo.flying.puzzle;

import ohos.agp.components.AttrSet;
import ohos.agp.components.Component;
import ohos.app.Context;

/**
 * @author wupanjie
 */
public class SquarePuzzleView extends PuzzleView implements Component.EstimateSizeListener {
  public SquarePuzzleView(Context context) {
    super(context);
  }

  public SquarePuzzleView(Context context, AttrSet attrs) {
    super(context, attrs);
  }

  public SquarePuzzleView(Context context, AttrSet attrs, int defStyleAttr) {
    super(context, attrs, defStyleAttr);
    setEstimateSizeListener(this);
  }

  @Override
  public boolean onEstimateSize(int i, int i1) {
    int width = getWidth();
    int height = getHeight();
    int length = width > height ? height : width;
    setEstimatedSize(length, length);
    return true;
  }
}
